3.5.27 \(\int \cos (c+d x) (a+b \tan ^2(c+d x)) \, dx\) [427]

Optimal. Leaf size=28 \[ \frac {b \tanh ^{-1}(\sin (c+d x))}{d}+\frac {(a-b) \sin (c+d x)}{d} \]

[Out]

b*arctanh(sin(d*x+c))/d+(a-b)*sin(d*x+c)/d

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 28, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {3757, 396, 212} \begin {gather*} \frac {(a-b) \sin (c+d x)}{d}+\frac {b \tanh ^{-1}(\sin (c+d x))}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]*(a + b*Tan[c + d*x]^2),x]

[Out]

(b*ArcTanh[Sin[c + d*x]])/d + ((a - b)*Sin[c + d*x])/d

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 396

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*x*((a + b*x^n)^(p + 1)/(b*(n*(
p + 1) + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rule 3757

Int[sec[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^(n_))^(p_.), x_Symbol] :> With[{ff = F
reeFactors[Sin[e + f*x], x]}, Dist[ff/f, Subst[Int[ExpandToSum[b*(ff*x)^n + a*(1 - ff^2*x^2)^(n/2), x]^p/(1 -
ff^2*x^2)^((m + n*p + 1)/2), x], x, Sin[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/2] &&
IntegerQ[n/2] && IntegerQ[p]

Rubi steps

\begin {align*} \int \cos (c+d x) \left (a+b \tan ^2(c+d x)\right ) \, dx &=\frac {\text {Subst}\left (\int \frac {a-(a-b) x^2}{1-x^2} \, dx,x,\sin (c+d x)\right )}{d}\\ &=\frac {(a-b) \sin (c+d x)}{d}+\frac {b \text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\sin (c+d x)\right )}{d}\\ &=\frac {b \tanh ^{-1}(\sin (c+d x))}{d}+\frac {(a-b) \sin (c+d x)}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.02, size = 47, normalized size = 1.68 \begin {gather*} \frac {b \tanh ^{-1}(\sin (c+d x))}{d}+\frac {a \cos (d x) \sin (c)}{d}+\frac {a \cos (c) \sin (d x)}{d}-\frac {b \sin (c+d x)}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]*(a + b*Tan[c + d*x]^2),x]

[Out]

(b*ArcTanh[Sin[c + d*x]])/d + (a*Cos[d*x]*Sin[c])/d + (a*Cos[c]*Sin[d*x])/d - (b*Sin[c + d*x])/d

________________________________________________________________________________________

Maple [A]
time = 0.16, size = 39, normalized size = 1.39

method result size
derivativedivides \(\frac {b \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+\sin \left (d x +c \right ) a}{d}\) \(39\)
default \(\frac {b \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+\sin \left (d x +c \right ) a}{d}\) \(39\)
risch \(-\frac {i {\mathrm e}^{i \left (d x +c \right )} a}{2 d}+\frac {i {\mathrm e}^{i \left (d x +c \right )} b}{2 d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} a}{2 d}-\frac {i {\mathrm e}^{-i \left (d x +c \right )} b}{2 d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) b}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) b}{d}\) \(103\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)*(a+b*tan(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/d*(b*(-sin(d*x+c)+ln(sec(d*x+c)+tan(d*x+c)))+sin(d*x+c)*a)

________________________________________________________________________________________

Maxima [A]
time = 0.29, size = 46, normalized size = 1.64 \begin {gather*} \frac {b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right ) - 2 \, \sin \left (d x + c\right )\right )} + 2 \, a \sin \left (d x + c\right )}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)^2),x, algorithm="maxima")

[Out]

1/2*(b*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1) - 2*sin(d*x + c)) + 2*a*sin(d*x + c))/d

________________________________________________________________________________________

Fricas [A]
time = 3.12, size = 44, normalized size = 1.57 \begin {gather*} \frac {b \log \left (\sin \left (d x + c\right ) + 1\right ) - b \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (a - b\right )} \sin \left (d x + c\right )}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)^2),x, algorithm="fricas")

[Out]

1/2*(b*log(sin(d*x + c) + 1) - b*log(-sin(d*x + c) + 1) + 2*(a - b)*sin(d*x + c))/d

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan ^{2}{\left (c + d x \right )}\right ) \cos {\left (c + d x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)**2),x)

[Out]

Integral((a + b*tan(c + d*x)**2)*cos(c + d*x), x)

________________________________________________________________________________________

Giac [A]
time = 0.59, size = 48, normalized size = 1.71 \begin {gather*} \frac {b {\left (\log \left ({\left | \sin \left (d x + c\right ) + 1 \right |}\right ) - \log \left ({\left | \sin \left (d x + c\right ) - 1 \right |}\right ) - 2 \, \sin \left (d x + c\right )\right )} + 2 \, a \sin \left (d x + c\right )}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)^2),x, algorithm="giac")

[Out]

1/2*(b*(log(abs(sin(d*x + c) + 1)) - log(abs(sin(d*x + c) - 1)) - 2*sin(d*x + c)) + 2*a*sin(d*x + c))/d

________________________________________________________________________________________

Mupad [B]
time = 11.87, size = 32, normalized size = 1.14 \begin {gather*} \frac {\sin \left (c+d\,x\right )\,\left (a-b\right )}{d}+\frac {2\,b\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)*(a + b*tan(c + d*x)^2),x)

[Out]

(sin(c + d*x)*(a - b))/d + (2*b*atanh(tan(c/2 + (d*x)/2)))/d

________________________________________________________________________________________